cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(recipe_20 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(PkgConfig REQUIRED QUIET)

pkg_search_module(ZeroMQ REQUIRED libzeromq libzmq lib0mq IMPORTED_TARGET)

if(TARGET PkgConfig::ZeroMQ) # 检查名为PkgConfig::ZeroMQ的导入目标是否存在
    message(STATUS "Found ZeroMQ") # 如果存在，则打印状态消息
endif()

add_executable(hwserver hwserver.cpp)         # 添加hwserver可执行文件
target_link_libraries(hwserver PkgConfig::ZeroMQ) # 将hwserver链接到ZeroMQ导入目标

add_executable(hwclient hwclient.cpp)         # 添加hwclient可执行文件
target_link_libraries(hwclient PkgConfig::ZeroMQ) # 将hwclient链接到ZeroMQ导入目标
